package com.plat.net.dns;

import io.netty.channel.Channel;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.handler.codec.dns.DatagramDnsQueryDecoder;
import io.netty.handler.codec.dns.DatagramDnsResponseEncoder;


public class DnsServerChannelInitializer extends AbstractChannel<NioDatagramChannel> {
    @Override
    protected void pipeline(Channel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast("dnsDecode",new DatagramDnsQueryDecoder());
        pipeline.addLast("dnsEncode",new DatagramDnsResponseEncoder());
        pipeline.addLast(new DnsHandler());
    }
}
